﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MillerApp.Business.Rules.Common;
using MillerApp.DataContract.MillerDB;
using MillerApp.Business.Stock;
using MillerApp.DataContract.Common.Entity;
using MillerApp.DataContract.Common;

namespace MillerApp.Business.Rules.Stock
{
    public class AutoGetSecuritiesInfos : BaseRule
    {
        /// <summary>
        /// 执行规则获取证券相关信息
        /// </summary>
        /// <param name="ruleParams"></param>
        public override void Execute(List<KeyValueEntry> ruleParams)
        {
            try
            {
                List<KeyValueEntry> secCodeList = new List<KeyValueEntry>();
                List<SecurityEntity> list = SecurityService.GetAllSecurities();
                if (list == null || list.Count <= 0)
                {
                    return;
                }
                foreach (var item in list)
                {
                    secCodeList.Add(new KeyValueEntry(item.stockexchangecode, item.seccode));
                }
                SecurityService service = new SecurityService();
                service.ALLSecCodeList = secCodeList;
                DelegateMessageHanldler handler = new DelegateMessageHanldler(HanlderMessage);
                service.AutoGetSecuritiesHQXX(handler);
            }
            catch (Exception ex)
            {
                //throw;
            }
        }
        private object HanlderMessage(IDictionary<string, object> methodParams)
        {
            return null;
        }
    }
}
